package com.muyu.system.domain.model;

import com.muyu.common.core.web.model.QueryModel;
import com.muyu.system.domain.req.SysLogininforListReq;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.util.Date;

/**
 * 参数配置 分页 模型
 */

@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class SysLogininforPageQueryModel extends QueryModel<SysLogininforPageQueryModel> {

    /**
     * 用户账号
     */
    private String userName;
    /**
     * 状态 0成功 1失败
     */
    private String status;
    /**
     * 地址
     */
    private String ipaddr;
    /**
     * 开始时间
     */
    private Date beginTime;
    /**
     * 结束时间
     */
    private Date endTime;

    public static SysLogininforPageQueryModel reqBuild(SysLogininforListReq sysLogininforListReq) {
        SysLogininforPageQueryModel sysLogininforPageQueryModel = SysLogininforPageQueryModel.builder()
                .userName(sysLogininforListReq.getUserName())
                .status(sysLogininforListReq.getStatus())
                .ipaddr(sysLogininforListReq.getIpaddr())
                .beginTime(sysLogininforListReq.getBeginTime())
                .endTime(sysLogininforListReq.getEndTime())
                .build();
        sysLogininforPageQueryModel.domainBuild(sysLogininforListReq);
        return sysLogininforPageQueryModel;
    }
}
